<?php
require_once 'common.php';

/**
 * 站内消息模型
 * @author wangjiajun
 *
 */
class OaEmailModel extends OpModel
{

    private $_emailTable;
    
    public function __construct($logger = null)
    {
        if (is_null($logger)) {
            $logger = getOaModelLogger();
        }
        parent::__construct($logger);
        $dbConfig = Oa_Util_Config::getSingleDbConfig(OA_WEB_DB_CLUSTER_ID);
        $db = OpDbModel::getInstance($dbConfig, $logger);
        $this->_emailTable = new OpTableModel($db, 'send_email_config', $logger);
    }
    
    
    public function getSendEmailList($where = null, $offset = 0, $count = null, 
        $sort = null, $otherWhere = null)
    {
        return $this->_emailTable->get($where, $offset, $count, $sort, $otherWhere);
    }
    
    public function addSendEmail($param)
    {
        return $this->_emailTable->insert($param, null, false);
    }
    
    public function updateSendEmail($id,$param)
    {
        return $this->_emailTable->update(array('id' => $id), $param);
    }
    
    public function deleteSendEmail($id)
    {
        return $this->_emailTable->update(array('id' => $id), array('delete_flag' => 1));
    }
    
}